 //==========================================================================
 /**
 * @file	  : Mesh.h
 * @author : cpzhang <chengpengzhang@gmail.com>
 * created : 2010-5-5   15:25
 * purpose : 
 */
 //==========================================================================
 
 #ifndef __Mesh_h__
 #define __Mesh_h__
 
//
#include "Common.h"
#include "RenderableObject.h"
//
 namespace Euclid
 {
	 class _EuclidExport_ Mesh : public RenderableObject
	 {
	 public:
		 Mesh();
		 ~Mesh();
	//
	 public:
		 virtual bool create();
		 virtual void destroy();

		 virtual void preRender();
		 virtual void postRender();
		 //
		 virtual void render();
		 //
	 public:
		 bool createTeapot();
		 bool loadMeshFromX(std::string& file, unsigned long flag = D3DXMESH_SYSTEMMEM);
	 //
	 private:
		 LPD3DXMESH				_mesh;
		 IDirect3DDevice9*		_device;
		 ID3DXBuffer*			_xMaterialBuffer;
		 unsigned long			_numMaterial;
		 D3DMATERIAL9*			_materials;
		 LPDIRECT3DTEXTURE9*	_textures;
	 };
 }
 
 #endif // __Mesh_h__
